package tech.aistar.mapper.adopt;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.adopt.AdoptApplication;

import java.util.List;

/**
 * Created by 陆锦鹏 on 2019/9/24.
 */
public interface AdoptApplicationMapper {
    @Select("select * from adopt_application")
    List<AdoptApplication> findAll();

    @Select("select * from adopt_application where ord_id=#{value}")
    AdoptApplication findOneById(Integer id);

    @Update("update adopt_application set status = 1 where ord_id = #{value}")
    void delById(Integer id);

    @Insert("insert into adopt_application(user_id,user_name,phone,salary,taking_way,userAddress_id,ord_id) " +
            "values(#{userId},#{userName},#{phone},#{salary},#{takingWay},#{userAddressId},#{ordId})")
    void save(AdoptApplication adoptApplication);

    @Update("update adopt_application set user_id=#{userId},user_name=#{userName},phone=#{phone},salary=#{salary},taking_way=#{takingWay},userAddress_id=#{userAddressId},ord_id=#{ordId} where id=#{id}")
    void update(AdoptApplication adoptApplication);
}
